<?php
$baseUrl = base_url ();
?>
<html>
<head>
<title>Dialogue</title>
<link href="/skin/jplayer/blue.monday/jplayer.blue.monday.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript" src='/js/jquery.min.js'></script>
<script type="text/javascript" src="<?=$baseUrl . 'js/jquery.jplayer.min.js'?>"></script>
<script type="text/javascript">
jQuery(function(){
	jQuery('.mediaPlay').toggle(
				mediaPlay,
				mediaStop
		);
});

var mediaStop=function(){
	jQuery('#jquery_jplayer_1').jPlayer("stop"); // stop audio
}
var mediaPlay=function(){
	var url='/index.php/media/play';
	jQuery.ajax({
		type : "post",
		url: url,
		//dataType:"json",
		dataType:'text',
		//data: {'orderItemId':orderItemId,'refundStatus':refundStatus,'email':email},
		success : function(html) {
			jQuery('#audioContainer').html(html);
			jQuery('#audioContainer').fadeOut();
			//if(jsonObj.success){
			//	var data=jsonObj.result;
			//	var refundStatusId="#orderItemsRefundStatus_"+orderItemId;
			//	jQuery(refundStatusId).html(data.refundStatus);
			//}else{
			//	showError("fail");
			//}
		}
	});

}
</script>

</head>
<body>

<div id="audioContainer" style="display:none;"></div>
<table>
	<tr>
		<td>dialogue_sentence_id</td>
		<td>target_audio</td>
		<td>source</td>
	</tr>
<?php
foreach ( $dialogs as $key => $dialog ) :
    ?>
<tr>
		<td><?php
    echo $dialog ['dialogue_sentence_id']?></td>
		<td><?php
    echo $dialog ['target_audio']?></td>
		<td><?php
    echo $dialog ['source']?></td>
		<td>
			<a  class="mediaPlay" href="javascript:void(0)">Play</a>
		</td>
	</tr>

<?php endforeach; ?>
</table>
</body>
</html>
